var request;
var color = "#888888";
var grid = "";
var position;
var panelColGap;
var panelRowGap;
var isIE = document.all;
var imagePath = 'url("/d2/_img/';

function checkIE() {
	navigator.appName == "Microsoft Internet Explorer" ? isIE = true
			: isIE = false;
}

if (isIE) {
	panelColGap = 102;
	panelRowGap = 278;
} else {
	panelColGap = 101;
	panelRowGap = 277;
}

// ============================================================== expand button
var commentBtn = new Array();
// �迭�Ӽ� � xxx.yyy=zzz; �Է¶Ǵ� � xxx[yyy];
commentBtn.toggleBtn_style = "style";
commentBtn.toggleBtn_size = "size";
commentBtn.toggleBtn_source = "source";
commentBtn.toggleBtn_color = "color";
commentBtn.toggleBtn_grid = "color";
commentBtn.toggleBtn_direction = "direction";
commentBtn.toggleBtn_position = "position";

commentBtn.exBtn_style_halfSleeve = "half sleeve";
commentBtn.exBtn_style_nonSleeve = "non sleeve";
commentBtn.exBtn_style_MTM = "MTM";
commentBtn.exBtn_style_nonSibori = "non sibori";
commentBtn.exBtn_style_hood = "hood";

commentBtn.exBtn_size_XS = "XS (85) ";
commentBtn.exBtn_size_S = "S (90)";
commentBtn.exBtn_size_M = "M (95) ";
commentBtn.exBtn_size_L = "L (100) ";
commentBtn.exBtn_size_XL = "XL (105) ";

commentBtn.exBtn_source_Local = "Local";
commentBtn.exBtn_source_Web = "Web";
commentBtn.exBtn_source_Tag = "tag";
commentBtn.exBtn_source_Category = "category";

commentBtn.exBtn_color_FFFFFF = "(FFFFFF) ";
commentBtn.exBtn_color_000000 = "(000000) ";
commentBtn.exBtn_color_FF0000 = "(FF0000) ";
commentBtn.exBtn_color_0000FF = "(0000FF) ";
commentBtn.exBtn_color_FFFF00 = "(FFFF00) ";
commentBtn.exBtn_color_00FF00 = "(00FF00) ";
commentBtn.exBtn_color_BBBBBB = "(BBBBBB) ";

commentBtn.exBtn_grid_X = "X";
commentBtn.exBtn_grid_12 = "12px ";
commentBtn.exBtn_grid_12dot = "12px(dot)";
commentBtn.exBtn_grid_18 = "18px ";
commentBtn.exBtn_grid_18dot = "18px(dot)";
commentBtn.exBtn_grid_24 = "24px ";
commentBtn.exBtn_grid_24dot = "24px(dot)";
commentBtn.exBtn_grid_30 = "30px ";
commentBtn.exBtn_grid_30dot = "30px(dot)";
commentBtn.exBtn_grid_36 = "36px ";
commentBtn.exBtn_grid_36dot = "36px(dot)";

commentBtn.exBtn_direction_F = "Front";
commentBtn.exBtn_direction_B = "Back";
commentBtn.exBtn_direction_R = "Rear";
commentBtn.exBtn_direction_L = "Left";
commentBtn.exBtn_direction_T = "Top";

commentBtn.exBtn_position_00 = "01";
commentBtn.exBtn_position_01 = "02 ";
commentBtn.exBtn_position_02 = "03";
commentBtn.exBtn_position_03 = "04";
commentBtn.exBtn_position_04 = "05";
commentBtn.exBtn_position_05 = "06";

var presentExBtn = "";
function expandBtn(object) {
	var toggle = object.nextSibling.nextSibling;
	var lis = toggle.getElementsByTagName("li");

	if (presentExBtn == "") {
		for (var i = 0; i < lis.length; i++) {
			lis[i].style.display = "inline";
		}
		presentExBtn = object;
		object.parentNode.style.backgroundImage = imagePath + 'openBox.gif")';
	} else if (presentExBtn == object) {
		for (var i = 0; i < lis.length; i++) {
			lis[i].style.display = "none";
		}
		presentExBtn = "";
		object.parentNode.style.backgroundImage = imagePath
				+ 'closeBox_02.gif")';
	} else {
		object.parentNode.style.backgroundImage = imagePath + 'openBox.gif")';
		presentExBtn.parentNode.style.backgroundImage = imagePath
				+ 'closeBox_02.gif")';

		var oldlis = presentExBtn.nextSibling.nextSibling
				.getElementsByTagName("li");
		for (var i = 0; i < oldlis.length; i++) {
			oldlis[i].style.display = "none";
		}

		for (var i = 0; i < lis.length; i++) {
			lis[i].style.display = "inline";
		}
		presentExBtn = object;
	}

}

var selector = new Array();
selector.selected_style = "exBtn_style_halfSleeve";
selector.selected_size = "exBtn_size_M";
selector.selected_source = "exBtn_source_PC";
selector.selected_color = "exBtn_color_FFFFFF";
selector.selected_grid = "exBtn_grid_12";
selector.selected_direction = "exBtn_direction_F";
selector.selected_position = "exBtn_position_00";

function countBrother(object) {
	var parent = object.parentNode;
	var eldest = parent.firstChild.nextSibling;
	var cnt = 0;
	while (object != eldest) {
		object = object.previousSibling.previousSibling;
		cnt++;
	}
	return cnt;
}

function changeToggleBtn(object) {
	var parent = object.parentNode;
	var parentBrother = parent.previousSibling.previousSibling;
	var cousins = parentBrother.getElementsByTagName("li");
	for (var i = 0; i < cousins.length; i++) {
		cousins[i].style.display = "none";
	}
	cousins[countBrother(object)].style.display = "inline";
}

function click_exBtn() {
	changeToggleBtn(this);
	var id = this.id;
	var toggleBtn = id.substring(id.indexOf('_') + 1, id.lastIndexOf('_'));
	var exBtn = id.substr(id.lastIndexOf('_') + 1, id.length);

	var parentId = this.parentNode.id;
	if (parentId == "exBtns_style") {
		changeStyle(exBtn);
	} else if (parentId == "exBtns_size") {
		changeSize(exBtn);
	} else if (parentId == "exBtns_source") {
		changeFinder(this);
	} else if (parentId == "exBtns_color") {
		changeColor(exBtn);
	} else if (parentId == "exBtns_grid") {
		changeIGrid(exBtn);
	} else if (parentId == "exBtns_direction") {
		alert(exBtn + " : " + exBtn);
	} else if (parentId == "exBtns_position") {
		selectPosition(exBtn);
	}

	expandBtn(this.parentNode.previousSibling.previousSibling);
}
// =============================================================================

// ========================================================== exButton functions

var list_ext = null;
function fn_ext_list(id, defaultValue) {
	var selector = document.getElementById(id);
	var fisrtDiv = selector.getElementsByTagName("div")[0];
	var presentView = fisrtDiv.getElementsByTagName("div")[0];
	var fisrtInput = selector.getElementsByTagName("input")[0];
	var ul = selector.getElementsByTagName("ul")[0];

	fisrtDiv.onclick = function() {
		if (list_ext == null) {
			ul.style.display = "block";
			list_ext = ul;
			ul.onmouseleave = function() {
				ul.style.display = "none";
				list_ext = null;
			}
		} else {
			if (list_ext == ul) {
				ul.style.display = "none";
				list_ext = null;
			} else {
				list_ext.style.display = "none";
				ul.style.display = "block";
				list_ext = ul;
			}
		}
	}
	ul.onmouseleave = function() {
		ul.style.display = "none";
		list_ext = null;
	}

	var list = ul.getElementsByTagName("li");
	for (var i = 0; i < list.length; i++) {
		list[i].onclick = function() {
			this.parentNode.style.display = "none";
			list_ext = null;
			fisrtInput.value = getText(this.getElementsByTagName("span")[0]);
			presentView.className = this.getElementsByTagName("div")[0].className;
		}
	}
	fisrtInput.value = getText(list[defaultValue].getElementsByTagName("span")[0]);
	presentView.className = list[defaultValue].getElementsByTagName("div")[0].className;
}

function changeFinder02() {

}

function changeStyle(style) {
	var Style = imagePath + style + '.gif")';
	document.getElementById("panel_forStyle").style.backgroundImage = Style;
}

function changeSize() {
	// alert(toggle + " : " + ex);
}

function changeFinder(object) {
	var searchers = document.getElementById("searchers");
	var divs = searchers.getElementsByTagName("div");
	for (var i = 0; i < divs.length; i++) {
		divs[i].style.display = "none";
	}
	divs[countBrother(object)].style.display = "block";
}

function changeColor(param) {
	document.getElementById('panel_forStyle').style.backgroundColor = "#"
			+ param;
	color = "#" + param;
}

function changeIGrid(param) {
	if (param == "X") {
		document.getElementById("panel_forGrid").style.background = null;

	} else {
		var gridStyle = imagePath + 'gridBy' + param + '.gif")';
		document.getElementById("panel_forGrid").style.background = gridStyle;
	}
}

function selectPosition(param) {
	var snaps = document.getElementById("snaps");
	var lis = snaps.getElementsByTagName("li");

	for (var i = 0; i < lis.length; i++) {
		lis[i].style.display = "none";
	}
	document.getElementById("snap" + param).style.display = "block";
	position = param;
}

function selectSearchEngine(engine) {
	searchDaum.style.display = "none";
	searchNaver.style.display = "none";
	searchGoogle.style.display = "none";

	switch (engine.substring(5, engine.length)) {
	case 'Daum':
		document.getElementById("searchDaum").style.display = "block";
		break;
	case 'Naver':
		document.getElementById("searchNaver").style.display = "block";
		break;
	case 'Google':
		document.getElementById("searchGoogle").style.display = "block";
		break;
	default:
		break;
	}
}
// =============================================================================

/* Ajax �ѱ� ó�Ұ� */
/* Ajax �ѱ� ó�Ұ� */
function showThisImage(type, c_id) {
	createRequest();
	var tag = document.getElementById("tagField").value;
	var url = "./searchTagImage.jsp?&dummy=" + new Date().getTime();
	if (type == "tag") {
		if (tag != "") {
			url += "&tag=" + tag;
		} else {
			alert("input tag plz");
			return;
		}
	} else if (type == "category") {
		url += "&c_id=" + c_id;
	}
	request.open("Get", url, true);
	request.onreadystatechange = listUpImage;
	request.send(null);
}

function reSize(max, image) {
	var reSized = new Array();
	reSized.h = image.height;
	reSized.w = image.width;

	if (image.height >= image.width) {
		if (max < image.height) {
			reSized.h = max;
			reSized.w = Math.round(image.width / image.height * max);
		}
	} else {
		if (max < image.width) {
			reSized.w = max;
			reSized.h = Math.round(image.height / image.width * max);
		}
	}
	return reSized;
}

function resultToArray(text) {
	var resultArray = new Array();
	while (text.length > 0) {
		resultArray[resultArray.length] = text.substr(0, text.indexOf("/"));
		text = text.substr(text.indexOf("/") + 1, text.length);
	}
	return resultArray;
}

var horizon = 96;
var vertical = 96;
var imageLimit = 30;

function listUpImage() {
	var tagImageList = document.getElementById("tagImageList");
	clearText(tagImageList);
	if (request.readyState == 4) {
		var resultAJAX = request.responseText;
		resultToArray(resultAJAX);
		if (resultToArray(resultAJAX)[0] == "no data") {
			var noData = document.createTextNode("no Data");
			tagImageList.appendChild(noData);
		} else {
			for (var i = 0; i < resultToArray(resultAJAX).length; i++) {
				var img = document.createElement("img");
				img.src = "./_files/" + resultToArray(resultAJAX)[i];
				var imgObject = new Image();
				(new Image()).src = "./_files/" + resultToArray(resultAJAX)[i];
				imgObject.src = "./_files/" + resultToArray(resultAJAX)[i];
				// var imgText =
				// document.createTextNode(resultToArray(resultAJAX)[i]);
				var itHeight = reSize(64, img).h;
				var itWidth = reSize(64, img).w;
				var imgText = document.createTextNode(imgObject.height);
				img.style.height = itHeight + "px";
				img.style.width = itWidth + "px";
				/* image prefetch */
				// img.style.height = "32px";
				// img.style.width = "32px";
				img.style.marginTop = (vertical - itHeight) / 2 + "px";
				img.style.marginRigth = (horizon - itWidth) / 2 + "px";
				img.style.marginBottom = (vertical - itHeight) / 2 + "px";
				img.style.marginLeft = (horizon - itWidth) / 2 + "px";
				img.style.border = "4px solid #888888";
				img.style.display = "block";
				tagImageList.appendChild(img);
				// alert(img.complete);
				tagImageList.appendChild(imgText);
				img.onclick = function() {
					if (listCount < imageLimit) {
						addToWork(this);
						listCount++;
					} else {
						alert("no more " + imageLimit + " images");
						return;
					}
				};
				img.onmouseover = function() {
					this.style.border = "4px solid #FF0000";
				};
				img.onmouseout = function() {
					this.style.border = "4px solid #888888";
				};
			}
		}
	} else if (request.readyState == 1) {
		var loading = document.createTextNode("loading Now");
		tagImageList.appendChild(loading);
	}
}

var topBuffer = 0;
var leftBuffer = 0;
var listCount = 0;

function addToWork(el) {
	var panel_forWork = document.getElementById("panel_forWork");
	var wrapper = document.createElement("div");
	var img = document.createElement("img");
	// var num =0;
	// for(var i=0; i<panel_forWork.childNodes.length; i++){
	// if(panel_forWork.childNodes[i].nodeName.toLowerCase() == "img"){
	// num++;
	// }
	// }
	var imgObject = new Image();
	leftBuffer = listCount * 48;
	if (listCount > 14) {
		topBuffer = 48;
		leftBuffer = leftBuffer - 720;
	}
	img.src = el.src;
	img.className = "workImage";
	img.style.height = reSize(32, el).h + "px";
	img.style.width = reSize(32, el).w + "px";

	wrapper.className = "workImageWrapper";
	wrapper.style.height = img.style.height;
	wrapper.style.width = img.style.width;
	wrapper.style.top = (topBuffer) + (32 - reSize(32, el).h) / 2 + "px";
	wrapper.style.left = (leftBuffer) + (32 - reSize(32, el).w) / 2 + "px";
	wrapper.style.marginTop = (64 - reSize(32, el).h) / 2 + "px";
	wrapper.style.marginRight = (48 - reSize(32, el).w) / 2 + "px";
	wrapper.style.marginBottom = (64 - reSize(32, el).h) / 2 + "px";
	wrapper.style.marginLeft = (48 - reSize(32, el).w) / 2 + "px";
	wrapper.onmousemove = function() {
	};

	img.onmousemove = function() {
	};
	img.onmousedown = function() {
	};
	img.onmouseup = function() {
	};
	wrapper.appendChild(img);
	// span.className="imgNo";
	// var div = document.createElement("div");
	// div.setAttribute("contenteditable","true");
	// div.className="virtual";
	// div.appendChild(img);
	panel_forWork.appendChild(wrapper);
	// var imgNo = document.createTextNode(num+1);
	// span.appendChild(imgNo);
	// div.appendChild(imgNo);
	// workImageList.insertBefore(div, img);
}
/* mouse action Event */
var dragEnabled;
var stretchEnabled;
var activeItem;
var mousePointX;
var mousePointY;
var Page;
var activeItem;
var elementWidth;
var elementHeight;
var elementRatio;
var elementTop;
var elementLeft;

function startDrag(e) {
	Page = isIE ? "BODY" : "HTML";
	activeItem = isIE ? event.srcElement : e.target;

	if (isIE) {
		if (!activeItem.parentElement) {
			return false;
		}
		mousePointX = event.clientX;
		mousePointY = event.clientY;

		if (activeItem.parentElement.className == "workImageWrapper") {
			if (activeItem.tagName == "IMG") {
				dragEnabled = true;
				elementTop = parseInt(activeItem.parentElement.style.top);
				elementLeft = parseInt(activeItem.parentElement.style.left);
				document.onmousemove = drag;
			}
		} else if (activeItem.className == "workImageWrapper") {
			elementWidth = parseInt(activeItem.offsetWidth);
			elementHeight = parseInt(activeItem.offsetHeight);
			elementRatio = elementWidth / elementHeight;
			stretchEnabled = true;
			document.onmousemove = stretch;
		} else {
			return false;
		}
	} else {
		if (!activeItem.parentNode) {
			return false;
		}
		mousePointX = e.clientX;
		mousePointY = e.clientY;

		if (activeItem.parentNode.className == "workImageWrapper") {
			if (activeItem.tagName == "IMG") {
				dragEnabled = true;
				elementTop = parseInt(activeItem.parentNode.style.top);
				elementLeft = parseInt(activeItem.parentNode.style.left);
				document.onmousemove = drag;
			}
		} else if (activeItem.className == "workImageWrapper") {
			elementWidth = parseInt(activeItem.offsetWidth);
			elementHeight = parseInt(activeItem.offsetHeight);
			elementRatio = elementWidth / elementHeight;
			stretchEnabled = true;
			document.onmousemove = stretch;
		} else {
			return false;
		}
	}
	return false;
}

function drag(e) {
	if (!dragEnabled)
		return true;
	if (isIE) {
		activeItem.parentElement.style.left = parseInt(elementLeft
				+ event.clientX - mousePointX)
				+ "px";
		activeItem.parentElement.style.top = parseInt(elementTop
				+ event.clientY - mousePointY)
				+ "px";
	} else {
		activeItem.parentNode.style.left = parseInt(elementLeft + e.clientX
				- mousePointX)
				+ "px";
		activeItem.parentNode.style.top = parseInt(elementTop + e.clientY
				- mousePointY)
				+ "px";
	}
	return false;
}

function stretch(e) {
	if (!stretchEnabled)
		return true;
	if (isIE) {
		activeItem.style.width = parseInt((elementHeight + event.clientY - mousePointY)
				* elementRatio)
				+ "px";
		activeItem.style.height = parseInt(elementHeight + event.clientY
				- mousePointY)
				+ "px";
		activeItem.childNodes[0].style.width = parseInt((elementHeight
				+ event.clientY - mousePointY)
				* elementRatio)
				+ "px";
		activeItem.childNodes[0].style.height = parseInt(elementHeight
				+ event.clientY - mousePointY)
				+ "px";
	} else {
		activeItem.style.width = parseInt((elementHeight + e.clientY - mousePointY)
				* elementRatio)
				+ "px";
		activeItem.style.height = parseInt(elementHeight + e.clientY
				- mousePointY)
				+ "px";
		activeItem.childNodes[0].style.width = parseInt((elementHeight
				+ e.clientY - mousePointY)
				* elementRatio)
				+ "px";
		activeItem.childNodes[0].style.height = parseInt(elementHeight
				+ e.clientY - mousePointY)
				+ "px";
	}
	return false;
}

function setStyle(id, att, val) {
	document.getElementById(id).style.att = val;
}

function selectorOfId(id) {
	return id.substr(0, id.indexOf('_'));
}

function optionOfId(id) {
	return id.substr(id.indexOf('_') + 1, id.length);
}

function uploadImage() {
	if (request.readyState == 4) {
		var result = request.responseText;
		if (result == "Right") {
			alert("right");
		} else {
			alert("fail :" + result);
		}
	}
}
/* category selection(Ajax) */
function goQuery(lv, pid) {
	createRequest();
	var url = "categoryProcess.jsp";
	url += "?pid=" + pid + "&lv=" + lv + "&dummy=" + new Date().getTime();
	request.open("Get", url, true);
	request.onreadystatechange = selectCategory;
	request.send(null);
}

var level;
function selectCategory() {
	if (request.readyState == 4) {
		var resultAJAX = request.responseText;
		var categoryLv = resultAJAX.substr(0, 11);
		resultAJAX = resultAJAX.substring(11, resultAJAX.length);
		resultToArray(resultAJAX);
		if (resultToArray(resultAJAX)[0] == "no data") {
			return true;
		}
		var selector = document.getElementById(categoryLv);
		level = categoryLv.substr(10, 1);
		var select = document.createElement("select");
		select.id = "categorySelector" + level;
		var option = document.createElement("option");
		var textNode = document.createTextNode(categoryLv);
		option.appendChild(textNode);
		select.appendChild(option);
		for (var i = 0; i < resultToArray(resultAJAX).length; i += 2) {
			var option = document.createElement("option");
			option.value = resultToArray(resultAJAX)[i];
			var textNode = document
					.createTextNode(resultToArray(resultAJAX)[i + 1]);
			option.appendChild(textNode);
			select.appendChild(option);
			select.onchange = function() {
				var nextSelector;
				switch (level) {
				case "1":
					nextSelector = document.getElementById("categoryLv2");
					clearText(nextSelector);
				case "2":
					nextSelector = document.getElementById("categoryLv3");
					clearText(nextSelector);
				case "3":
					nextSelector = document.getElementById("categoryLv4");
					clearText(nextSelector);
				case "4":
					break;
				default:
					break;
				}
				level++;
				// showThisImage('category',this.value);
				goQuery("categoryLv" + level, this.value);
			};
		}
		if (selector != null) {
			clearText(selector);
			selector.appendChild(select);
		}
	}
	return true;
}

function fn_setReadOnly() {
	var inputs = document.getElementsByTagName("input");
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].className.indexOf("readOnly") > -1) {
			inputs[i].readOnly = true;
		}
	}
}
/* ************************************************************************** */
/* ********************************* window.onload ************************** */
/* ************************************************************************** */
window.onload = function() {
	fn_drawRuler_row_cm();
	fn_drawRuler_col_cm();
	fn_setReadOnly();

	var divs = document.getElementsByTagName("div");
	for (i = 0; i < divs.length; i++) {
		if (divs[i].className == "selector") {
			fn_ext_list(divs[i].id, 0);
		}
	}
	// fn_ext_list("selector_source", 0);
	// fn_ext_list("selector_type" ,0);

	var controler = document.getElementById("controler");

	var uls = controler.getElementsByTagName("ul");
	for (var i = 0; i < uls.length; i++) {
		if (i % 2 == 0) {
			var lis = uls[i].getElementsByTagName("li");
			for (var j = 0; j < lis.length; j++) {
				lis[j].className = "toggleBtns";
				lis[j].onclick = function() {
					expandBtn(this.parentNode);
				};
			}
			lis[0].style.display = "block";
		} else {
			var lis = uls[i].getElementsByTagName("li");

			for (var k = 0; k < lis.length; k++) {
				lis[k].className = "exBtns";
				lis[k].onclick = click_exBtn;
				lis[k].onmousemove = setCursorPostion;
				lis[k].onmouseover = function() {
					viewComment(commentBtn[this.id] + "");
				};
				lis[k].onmouseout = function() {
					outComment();
				};
			}
		}
	}

	var divs = controler.getElementsByTagName('div');
	for (var i = 0; i < divs.length; i++) {
		divs[i].style.backgroundImage = 'url("./_img/closeBox_02.gif")';
	}

	var lis = controler.getElementsByTagName('li');
	for (var i = 0; i < lis.length; i++) {
		var file = imagePath + lis[i].id + '.gif")';
		lis[i].style.backgroundImage = file;
	}

	var engins = document.getElementById("engins");
	var lis = engins.getElementsByTagName('li');
	for (var i = 0; i < lis.length; i++) {
		lis[i].onclick = function() {
			selectSearchEngine(this.id);
		};
	}

	// var selected = document.getElementById("selected");
	// var divs = selected.getElementsByTagName('div');
	// for ( var i = 0; i < divs.length; i++) {
	// var file = imagePath + selector[divs[i].id] + '.gif")';
	// divs[i].style.backgroundImage = file;
	// divs[i].className = "selected_class";
	// }

	var pathByPC = document.getElementById("pathByPC");
	pathByPC.setAttribute('size', '18');
	pathByPC.onchange = function() {
		document.fmUpload.target = "upload_target";
		document.fmUpload.action = "./uploadFile.jsp";
		document.fmUpload.enctype = "multipart/form-data";
		document.fmUpload.method = "post";
		document.fmUpload.submit();

		var fileName = document.getElementById("fileName");

		var preview = document.getElementById("preview");
		preview.style.width = "100px";
		preview.style.height = "100px";
		var file = 'url("/m2/_upload/user01/"' + pathByPC.nodeValue + ')';
		preview.style.backgroundImage = file;
	};

	var worker = document.getElementById("worker");
	var worker_div = worker.getElementsByTagName('div');
	for (var i = 0; i < worker_div.length; i++) {
		if (worker_div[i].id.substr(0, 6) == "panel_") {
			worker_div[i].className = "panel_class";
		}
	}

	// goQuery('categoryLv1', 'root');

	document.getElementById("panel_forWork").onmousedown = startDrag;
	document.getElementById("panel_forWork").onmouseup = function() {
		dragEnabled = false;
		stretchEnabled = false;
	};
	// showThisImage('tag');
	// initMouseCapture();
	/*
	 * ******************************************************************
	 * [option
	 */
	/*
	 * if (dt[i].id.substr(0, 7) == "option_") { dt[i].className =
	 * "stylishSelection"; dt[i].onclick = stylishSelection; }
	 * document.getElementById("option_style_halfSleeve").style.display="block";
	 * document.getElementById("option_RGB_FFFFFF").style.color = "#000000";
	 * document.getElementById("option_RGB_FFFFFF").style.display="block";
	 * document.getElementById("option_size_100").style.display="block";
	 * document.getElementById("option_grid_12").style.display="block";
	 * document.getElementById("option_source_PC").style.display="block";
	 * document.getElementById("option_direction_F").style.display="block";
	 * document.getElementById("option_position_F").style.display="block";
	 * 
	 * if (dt[i].id.substr(0, 10) == "option_RGB") { dt[i].style.color = "#" +
	 * dt[i].id.substr(11, dt[i].id.length); }
	 */
	/*
	 * ******************************************************************
	 * option]
	 */
};

/* ************************************************************************** */
/* disabled functions */
/* ************************************************************************** */
/*
 * function stylishSelection(id) { var id = this.id; var selector =
 * selectorOfId(id.substring(7, id.length)); var option =
 * optionOfId(id.substring(7, id.length)); var dt =
 * document.getElementsByTagName('dt'); if (expand[selector] == 0) { for (var i =
 * 0; i < dt.length; i++) { if (dt[i].id.substr(7, selector.length) == selector) {
 * dt[i].style.display = "block"; expand[selector] = 1; } } } else { for (var i =
 * 0; i < dt.length; i++) { if (dt[i].id.substr(7, selector.length) == selector)
 * dt[i].style.display = "none"; }
 * 
 * switch (selector) { case "style": changeStyle(option); break; case "RGB":
 * document.getElementById('panel_forStyle').style.backgroundColor = "#" +
 * option; color = "#" + option; break; case "size": break; case "grid":
 * changeIGrid(option); grid = option; break; case "source":
 * changeFinder(option); break; case "direction": break; case "position": break;
 * default: break; } document.getElementById(id).style.display = "block";
 * expand[selector] = 0; } }
 * 
 * function viewThisImage(path) { var previewer =
 * document.getElementById("previewer"); previewer.style.height = "200px";
 * previewer.style.width = "200px"; previewer.src = path;
 * 
 * var imgInfo = new Image(); imgInfo.onload = img_Load2; imgInfo.src = path; }
 * 
 * function alertSize() { var myWidth = 0, myHeight = 0; if
 * (typeof(window.innerWidth) == 'number') { //Non-IE myWidth =
 * window.innerWidth; myHeight = window.innerHeight; } else if
 * (document.documentElement && (document.documentElement.clientWidth ||
 * document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant
 * mode' myWidth = document.documentElement.clientWidth; myHeight =
 * document.documentElement.clientHeight; } else if (document.body &&
 * (document.body.clientWidth || document.body.clientHeight)) { //IE 4
 * compatible myWidth = document.body.clientWidth; myHeight =
 * document.body.clientHeight; } alert('Width = ' + myWidth + ' Height = ' +
 * myHeight); }
 * 
 * function reWidth(max, h, w) { var standardH = max; var standardW = max; var
 * originH = h; var originW = w;
 * 
 * if (h >= w) { if (max < h) { h = standardH; w = Math.round(w / originH *
 * standardH); } } else { if (max < w) { w = standardW; h = Math.round(h /
 * originW * standardW); } } return w; }
 * 
 * function reHeight(max, h, w) { var standardH = max; var standardW = max; var
 * originH = h; var originW = w; if (h >= w) { if (max < h) { h = standardH; w =
 * Math.round(w / originH * standardH); } } else { if (max < w) { w = standardW;
 * h = Math.round(h / originW * standardW); } } return h; }
 */